import cv2
img = cv2.imread("../images/text.png")
h,w,_ = img.shape
#进行仿射变换
#1获取旋转矩阵
M = cv2.getRotationMatrix2D(
    center = (w//2,h//2),
    angle = 15,
    scale = 0.7
)
#进行变换
warp_img = cv2.warpAffine(
    img,
    M,
    (w,h),
    flags = cv2.INTER_LINEAR,
    borderMode= cv2.BORDER_CONSTANT,
    borderValue=(255,255,255)
)
cv2.imshow("wrap img",warp_img)
cv2.imwrite("wrap_text.png",warp_img)
cv2.waitKey(0)
